package com.icinfo.cloud.provider.punish.config.controller;

import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.config.service.IConfigPoliceAdjudicationService;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.PoliceAdjudicationDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.PoliceAdjudicationModifyDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.PoliceAdjudicationVo;
import com.icinfo.framework.common.web.Result;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 描述:  config_police_adjudication 对应的Controller类.<br>
 *
 * @author lujiayu
 * @date 2024年01月02日
 */
@RestController
@RequestMapping("/punish/config/policeAdjudication")
public class ConfigPoliceAdjudicationController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(ConfigPoliceAdjudicationController.class);
    @Autowired
    private IConfigPoliceAdjudicationService configPoliceAdjudicationService;

    /**
     * 【V1.12.1】描述： 公安裁量和记分配置分页查询
     *
     * @return {@link Result <  PageResponse <PoliceAdjudicationVo >>}
     * @author: lujiayu
     * @date: 2024/1/2
     * @param: policeAdjudicationDto
     **/
    @PostMapping("/pageList")
    @ApiOperation(value = "描述：公安裁量和记分配置查询", httpMethod = "POST")
    public Result<PageResponse<PoliceAdjudicationVo>> getPoliceAdjudicationPageList(@RequestBody @Validated PoliceAdjudicationDto policeAdjudicationDto) {
        PageResponse<PoliceAdjudicationVo> list = configPoliceAdjudicationService.getPoliceAdjudicationPageList(policeAdjudicationDto);
        return Result.success(Constant.STRING_GET_SUCCESS, list);
    }

    /**
     * 【V1.12.1】描述： 通过事项代码查询公安裁量和记分配置(不分页)
     *
     * @return {@link Result <  PageResponse <PoliceAdjudicationVo >>}
     * @author: lujiayu
     * @date: 2024/1/2
     * @param: policeAdjudicationDto
     **/
    @GetMapping("/getByItemRelationCode")
    @ApiOperation(value = "描述：通过事项编码查询公安裁量和记分配置查询", httpMethod = "GET")
    public Result<PoliceAdjudicationVo> getByItemRelationCode(@RequestParam String itemRelationCode) {
        return Result.success(Constant.STRING_GET_SUCCESS, configPoliceAdjudicationService.getByItemRelationCode(itemRelationCode));
    }

    /**
     * 【V1.12.1】描述： 公安裁量和记分配置修改
     *
     * @return {@link Result <  PageResponse <PoliceAdjudicationVo>>}
     * @author: lujiayu
     * @date: 2024/1/2
     * @param: policeAdjudicationDto
     **/
    @PostMapping("/update")
    @ApiOperation(value = "描述：公安裁量和记分配置修改", httpMethod = "POST")
    public Result<String> updatePoliceAdjudication(@RequestBody @Validated PoliceAdjudicationModifyDto policeAdjudicationModifyDto) {
        return configPoliceAdjudicationService.updatePoliceAdjudication(policeAdjudicationModifyDto);
    }


}
